﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    private string Encrypt(string s)
    {
        Encoding ascii = Encoding.ASCII;
        string EncryptString;
        EncryptString = "";
        for (int i = 0; i < s.Length; i++)
        {
            int j;
            byte[] b = new byte[1];
            j = Convert.ToInt32(ascii.GetBytes(s[i].ToString())[0]);
            j = j + 5;
            b[0] = Convert.ToByte(j);
            EncryptString = EncryptString + ascii.GetString(b);
        }
        return EncryptString;
    }
    private string Decryptor(string s)
    {
        Encoding ascii = Encoding.ASCII;
        string DecryptorString;
        DecryptorString = "";
        for (int i = 0; i < s.Length; i++)
        {
            int j;
            byte[] b = new byte[1];
            j = Convert.ToInt32(ascii.GetBytes(s[i].ToString())[0]);
            j = j - 5;
            b[0] = Convert.ToByte(j);
            DecryptorString = DecryptorString + ascii.GetString(b);
        }
        return DecryptorString;
    }

    protected void btnEncrypt_Click(object sender, EventArgs e)
    {
        TextBox2.Text = Encrypt(TextBox1.Text);
    }
    protected void btnDecryptor_Click(object sender, EventArgs e)
    {
        TextBox2.Text = Decryptor(TextBox2.Text);
    }
}
